import { ChangeText } from './test2.js'

let btn1 = document.querySelector('#btn1')
let clickCount = 0 //用于记录点击的次数

btn1.addEventListener('click', () => {
    clickCount++
    if (clickCount === 1) { alert("不要点我！") }
    else if (clickCount === 2) { alert("跟你说了不要再点我了！") }
    else if (clickCount >= 3) { alert("你听不进去是吧") }
})


let trs = document.querySelectorAll('tr')
for (let i = 0; i < trs.length; i++) {
    trs[i].addEventListener('mouseover', () => {
        trs[i].style.backgroundColor = 'red'
    })
    trs[i].addEventListener('mouseout', () => {
        trs[i].style.backgroundColor = 'antiquewhite'
    })
}

let btn2 = document.querySelector('#temp_btn')
let p = document.querySelector('#temp_p')
let textLiner = document.querySelector('#temp_text')

btn2.addEventListener('click', () => {
    const temp_text = textLiner.value
    if (temp_text === '') { alert('请输入内容') }
    else { ChangeText(p, temp_text) }
})